<!doctype html>

<html>
<head>
  <link rel="shortcut icon" href="static/images/favicon.ico" type="image/x-icon">
  <title>attribute_rewriter.js (Closure Library API Documentation - JavaScript)</title>
  <link rel="stylesheet" href="static/css/base.css">
  <link rel="stylesheet" href="static/css/doc.css">
  <link rel="stylesheet" href="static/css/sidetree.css">
  <link rel="stylesheet" href="static/css/prettify.css">

  <script>
     var _staticFilePath = "static/";
     var _typeTreeName = "goog";
     var _fileTreeName = "Source";
  </script>

  <script src="static/js/doc.js">
  </script>


  <meta charset="utf8">
</head>

<body onload="grokdoc.onLoad();">

<div id="header">
  <div class="g-section g-tpl-50-50 g-split">
    <div class="g-unit g-first">
      <a id="logo" href="index.html">Closure Library API Documentation</a>
    </div>

    <div class="g-unit">
      <div class="g-c">
        <strong>Go to class or file:</strong>
        <input type="text" id="ac">
      </div>
    </div>
  </div>
</div>

<div class="clear"></div>

<h2><a href="local_closure_goog_labs_html_attribute_rewriter.js.html">attribute_rewriter.js</a></h2>

<pre class="prettyprint lang-js">
<a name="line1"></a>// Copyright 2014 The Closure Library Authors. All Rights Reserved.
<a name="line2"></a>//
<a name="line3"></a>// Licensed under the Apache License, Version 2.0 (the &quot;License&quot;);
<a name="line4"></a>// you may not use this file except in compliance with the License.
<a name="line5"></a>// You may obtain a copy of the License at
<a name="line6"></a>//
<a name="line7"></a>//      http://www.apache.org/licenses/LICENSE-2.0
<a name="line8"></a>//
<a name="line9"></a>// Unless required by applicable law or agreed to in writing, software
<a name="line10"></a>// distributed under the License is distributed on an &quot;AS-IS&quot; BASIS,
<a name="line11"></a>// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
<a name="line12"></a>// See the License for the specific language governing permissions and
<a name="line13"></a>// limitations under the License.
<a name="line14"></a>
<a name="line15"></a>
<a name="line16"></a>goog.provide(&#39;goog.labs.html.AttributeRewriter&#39;);
<a name="line17"></a>goog.provide(&#39;goog.labs.html.AttributeValue&#39;);
<a name="line18"></a>goog.provide(&#39;goog.labs.html.attributeRewriterPresubmitWorkaround&#39;);
<a name="line19"></a>
<a name="line20"></a>
<a name="line21"></a>/**
<a name="line22"></a> * The type of an attribute value.
<a name="line23"></a> * &lt;p&gt;
<a name="line24"></a> * Many HTML attributes contain structured data like URLs, CSS, or even entire
<a name="line25"></a> * HTML documents, so the type is a union of several variants.
<a name="line26"></a> *
<a name="line27"></a> * @typedef {(string |
<a name="line28"></a> *            goog.html.SafeHtml | goog.html.SafeStyle | goog.html.SafeUrl)}
<a name="line29"></a> */
<a name="line30"></a>goog.labs.html.AttributeValue;
<a name="line31"></a>
<a name="line32"></a>
<a name="line33"></a>/**
<a name="line34"></a> * A function that takes an attribute value, and returns a safe value.
<a name="line35"></a> * &lt;p&gt;
<a name="line36"></a> * Since rewriters can be chained, a rewriter must be able to accept the output
<a name="line37"></a> * of another rewriter, instead of just a string though a rewriter that coerces
<a name="line38"></a> * its input to a string before checking its safety will fail safe.
<a name="line39"></a> * &lt;p&gt;
<a name="line40"></a> * The meaning of the result is:
<a name="line41"></a> * &lt;table&gt;
<a name="line42"></a> *   &lt;tr&gt;&lt;td&gt;{@code null}&lt;/td&gt;
<a name="line43"></a> *       &lt;td&gt;Unsafe.  The attribute should not be output.&lt;/tr&gt;
<a name="line44"></a> *   &lt;tr&gt;&lt;td&gt;a string&lt;/td&gt;
<a name="line45"></a> *       &lt;td&gt;The plain text (not HTML-entity encoded) of a safe attribute
<a name="line46"></a> *           value.&lt;/td&gt;
<a name="line47"></a> *   &lt;tr&gt;&lt;td&gt;a {@link goog.html.SafeHtml}&lt;/td&gt;
<a name="line48"></a> *       &lt;td&gt;A fragment that is safe to be included as embedded HTML as in
<a name="line49"></a> *           {@code &lt;iframe srchtml=&quot;...&quot;&gt;}.&lt;/td&gt;&lt;/tr&gt;
<a name="line50"></a> *   &lt;tr&gt;&lt;td&gt;a {@link goog.html.SafeUrl}&lt;/td&gt;
<a name="line51"></a> *       &lt;td&gt;A URL that does not need to be further checked against the URL
<a name="line52"></a> *           white-list.&lt;/td&gt;&lt;/tr&gt;
<a name="line53"></a> *   &lt;tr&gt;&lt;td&gt;a {@link goog.html.SafeStyle}&lt;/td&gt;
<a name="line54"></a> *       &lt;td&gt;A safe value for a &lt;code&gt;style=&quot;...&quot;&lt;/code&gt; attribute.&lt;/td&gt;&lt;/tr&gt;
<a name="line55"></a> * &lt;/table&gt;
<a name="line56"></a> * &lt;p&gt;
<a name="line57"></a> * Implementations are responsible for making sure that &quot;safe&quot; complies with
<a name="line58"></a> * the contract established by the safe string types in {@link goog.html}.
<a name="line59"></a> * &lt;/p&gt;
<a name="line60"></a> *
<a name="line61"></a> * @typedef {function(goog.labs.html.AttributeValue) :
<a name="line62"></a> *           goog.labs.html.AttributeValue}
<a name="line63"></a> */
<a name="line64"></a>goog.labs.html.AttributeRewriter;
<a name="line65"></a>
<a name="line66"></a>
<a name="line67"></a>/**
<a name="line68"></a> * g4 presubmit complains about requires of this file because its clients
<a name="line69"></a> * don&#39;t use any symbols from it outside JSCompiler comment annotations.
<a name="line70"></a> * genjsdeps.sh doesn&#39;t generate the right dependency graph unless this
<a name="line71"></a> * file is required.
<a name="line72"></a> * Clients can mention this noop.
<a name="line73"></a> */
<a name="line74"></a>goog.labs.html.attributeRewriterPresubmitWorkaround = function() {};
</pre>


</body>
</html>
